package loganalyzervma;

import java.util.Vector;

/**
 *
 * @author eladh
 */
public class CardObject {
    
    private String cardName;
    private String port;
    private String cardProfile;
    private String state;
    private String width;
    private String speed;
    private String fw;
    private Vector cardParamContainer;
    
    public CardObject(){
        cardName = "";
        port = "";
        cardProfile = "";
        state = "";
        width = ""; 
        speed = "";
        fw = "";
        cardParamContainer = null;
    }
            
    public void setCardName(String st) {

        cardName = st.substring(st.lastIndexOf("card") + 1);
        cardName = st.substring(st.indexOf("card")+4);
    }
    
    public void setPort(String st) {
        port = st.substring(st.indexOf(" Port")+5, st.lastIndexOf(": "));
    }
    
    public void setCardProfile(String st) {
        cardProfile = st.substring(st.indexOf("type")+4, st.indexOf("in")-1);
    }
    
    public void setState(String st) {
        state = st.substring(st.indexOf("T_")+2, st.indexOf("' "));
    }
    
    public void setWidth(String st) {
        if (st.contains("width")){
            width = st.substring(st.indexOf("width of")+8, st.indexOf("and"));   
        }
    }
    
    public void setSpeed(String st) {
        if (st.contains("width")){
            speed = st.substring(st.lastIndexOf("of") + 2);
        }
    }
    
    public void setFW(String st) {
     
        fw = st.substring(st.lastIndexOf("FW Ver: ") + 1);
    }

    

    
    
    public void resetSpeedWidth(){
        width = ""; 
        speed = "";
    }
    public Vector getCardParamContainer() {
        cardParamContainer = new Vector();
        cardParamContainer.add(cardName);
        cardParamContainer.add(port);
        cardParamContainer.add(cardProfile);
        cardParamContainer.add(state);
        cardParamContainer.add(width);
        cardParamContainer.add(speed);
        cardParamContainer.add(fw);
        
        return cardParamContainer;
    }
}
